home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dirut
/
retain20.zip
/
RETAIN.DOC
< prev
next >
Wrap
Text File
|
1992-12-11
|
20KB
|
313 lines
--- RETAIN 2.0 by Jim Groeneveld, 11/12-92, retains current path.
Pure BATch equivalent of PUSH/POPDIR, up to 7 levels, no TSR.
Multiple memory sets.Optionally shows all nested path levels.
===Summary===
Vs. 2.0, BATch equiv. of PUSH/POPDIR, pure DOS, 7 levels, multiple sets, no TSR.
Version 2.0 optional advanced feature: user specification of RETURN.BAT file.
I sacrified one directory level to remember for maintaining a variable memory
file specification (RETURN). This file name and its location (previously fixed
to C:\RETURN.BAT) can be specified as a command line parameter or an
environment variable. It allows for maintaining multiple independent sets of
directories to remember (theoretically an unlimited number). Good for multiple
file systems (drives) and shells.
===CONTENTS of package===
This package (.ZIP) includes the following files:
RETAIN BAT 15,342 12-11-92 02:00:00 Original BATch program RETAIN
RETAINCD BAT 1,673 12-11-92 02:00:00 Combination of RETAIN and CD
$RETURN$ AUX 28 08-27-92 06:00:00 Auxiliary file (necessary)
RETAIN DOC 19,546 12-11-92 02:00:00 This documentation file
PATH-BUG ZIP 1,923 11-20-89 11:38:38 2 messages about DOS PATH bug
===USAGE: RETAIN current path===
Enter 'RETAIN [aux-path[aux-file]│*│[/│-]?│+ [rtn-spec]]'
from the directory to retain, in which:
aux-path = drive:\subdir\ of auxiliary file $RETURN$.AUX, incl. trailing '\';
aux-file = the eventual alternate auxiliary file name for $RETURN$.AUX;
* = list the currently stored paths (also with 'RETURN *');
? (or /? or -?) = display this help (also with 'RETURN [/│-]?');
+ = dummy first argument if only second one specified;
rtn-spec = (full drive, path and) file specification of the RETURN-file,
without '.BAT' extension, default C:\RETURN (new in version 2.0).
DO NOT SPECIFY OTHER PARAMETERS. THIS WILL PRODUCE ERRONEOUS RESULTS!
RETAIN may be called successive times to store up to 7 paths.
Instead of specifying the same names for the auxiliary path and the return file
path (and name) each time these may be defined as environment variables. For
the auxiliary path the variable name is RETAIN, for the return path (and file
name) it is RETURN. For example (from the DOS prompt or AUTOEXEC.BAT):
SET RETAIN=C:\UTIL\DATA\ (note trailing backslash)
SET RETURN=C:\UTIL\ or SET RETURN=C:\UTIL\GOBACK (excl. '.BAT')
Specified command line parameters will override these values.
===USAGE: RETURN to previous path===
Enter 'RETURN' (the literal command, not only the RETURN/ENTER-key) to return
to the very last path stored in the path list (no parameters!). This path is
removed from the list and RETAIN thus has one more level to store the next time.
Enter 'RETURN *' to list the currently stored paths.
===USAGE: RETAINCD to retain current path and change drive:subdirectory===
Enter 'RETAINCD drive┼path [aux-path[aux-file]│*│[/│-]?│+ [rtn-spec]]',
from the directory to retain, in which:
drive = drive specification to CD to, e.g. 'C:';
path = absolute (\[...[\...]]) or
relative (...[\...]) path specification to CD to.
At least one of these (either drive or path) or both _must_ be specified.
aux-path = drive:\subdir\ of auxiliary file $RETURN$.AUX, incl. trailing '\';
aux-file = the eventual alternate auxiliary file name for $RETURN$.AUX;
* = list the currently stored paths;
? (or /? or -?) = display this help;
+ = dummy second argument if additional third one specified;
rtn-spec = (full drive, path and) file specification of the RETURN-file,
without '.BAT' extension, default C:\RETURN (new in version 2.0).
***WARNING!!!***
MANY (LONG) PATHS MAY CAUSE BAT FILE LINES TO EXCEED 127 CHARACTERS.
THIS WILL CREATE UNPREDICTABLE, AND ERRONEOUS RESULTS!!!!!!!!!!!!!!!
IN SOME INSTANCES THE SYSTEM MAY EVEN HANG OR CRASH! Thus, though the algorithm
is correct the DOS command line length limitation may restrict its use.
===Determination of location (and name) of auxiliary file $RETURN$.AUX===
The auxiliary file $RETURN$.AUX will be searched for in the paths or as the
full file specification (eventually with different, alternative filename and
extension) from the data below in that order until it is found.
a. the first and only parameter when calling RETAIN
1. the full _path_ only, incl. trailing '\' (e.g. 'RETAIN C:\UTIL\') or
2. the full _file_specification_ (e.g. 'RETAIN C:\UTIL\AUX-FILE.$$$')
b. the environment variable %RETAIN% (specify environment variable RETAIN
either from the DOS prompt or in AUTOEXEC.BAT)
1. the full _path_ only, incl. trailing '\' (e.g. 'SET RETAIN=C:\UTIL\') or
2. the full _file_specification_ (e.g. 'SET RETAIN=C:\UTIL\AUX-FILE.$$$')
c. the ROOT directory of C: (C:\) (or automatically any APPENDed path)
d. the ROOT directory of the CURRENT drive (\)
e. the CURRENT directory (.\)
f. the PARENT directory of the current one (..\)
g. the SAME directory where RETAIN.BAT is residing:
if EXPLICITELY specified when starting RETAIN (by path, DOS 3.x&up only)
(NOT if RETAIN.BAT can only be found via the PATH!) (e.g. 'C:\UTIL\RETAIN')
h. the DOS PATH variable (this may take quite a while), new in version 1.1
So make sure to place or name $RETURN$.AUX such that it can be found in one of
these ways. All this effort is done because the DOS ECHO command can not write
lines without CRLF, so an external auxiliary file is necessary that already
contains such a line.
===Further remarks===
If using DOS 3.2&up and using the APPEND path utility do at least specify the
'/X' parameter when calling APPEND for the first time or the auxiliary file
still can not be found.
It is handy to put RETAIN.BAT in a directory that is in your path (e.g.
C:\UTIL) and to have C:\ in your path in order to be able to find the default
temporary created file C:\RETURN.BAT from any drive:subdirectory or to take care
to create the return file in a directory that is in your path.
In order to restart each time with an empty list when the system is booted
add the following statement to your AUTOEXEC.BAT file (for each return file):
IF EXIST c:\return.BAT DEL c:\return.BAT (eventually redirect this to NUL)
===Minimal system requirements===
IBM-PC (88/86/x86) or compatible
64kb memory
(MS)DOS 3.x or above; RETAIN vs. 1.1 still could be adapted easyly to work
under DOS 2.x (no use of environment variables and no explicit path
specifications before program calls), but this version relies highly upon the
specification of paths when calling itself (or other batch files); in fact
this is a main change. It can not be made suited for DOS 2.x because paths
and file names for return files would have to be separated. Besides, who still
is using DOS 2.x? (It could be made working under DOS 2.x, but that would need
a complete revision and revised syntax and its possibilities, the number of
paths stored, would decrease.) So from version 2.0 on only DOS 3.x and above
is required. If one has hardware that does not allow for these DOS versions
then one should use and adapt version 1.1 instead.
===New in version 2.0===
The name of RETAIN already might be changed with previous versions, though it
was not yet documented, as long as DOS would be able to find it. RETAIN (or
whatever it is called) knows its name (how it was called when started: %0) and
uses that knowledge to call itself directly and indirectly (from RETURN) some
times during its run. When it builds C:\RETURN.BAT (the return file) for the
first time it also stores its own calling name in it in order to be called from
there.
Up to vs. 2.0 the name and location of C:\RETURN.BAT was fixed within
RETAIN.BAT. The user might patch that if it did not apply (e.g. if there is
no C: drive). Now the name and location can be controlled from outside,
without changing RETAIN.BAT, via a second argument or an environment variable
RETURN. Without the use of user specified environment variables, introduced
with DOS 3.0 (?), RETAIN is compatible with all version